﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Milo.Tests.Mock.Controls
{
    using Framework;

    public class SimpleTypeControl : ListControl<SimpleType>, IListControl<SimpleType>
    {
        #region constructors
		public SimpleTypeControl() { }
        public SimpleTypeControl(SimpleType model) : base(model) { }
        public SimpleTypeControl(string name, SimpleType model) : base(name, model) { }
        #endregion

        #region model properties as controls
        private IFieldControl<string> stringValue;
        private IFieldControl<int> intValue;
        private IFieldControl<decimal> decimalValue;

        public IFieldControl<string> StringValue
        {
			get
			{
				if (stringValue == null)
				{
					stringValue = new FieldControl<string>();
					stringValue.LinkToParent("StringValue", this, get_StringValue_value, set_StringValue_value, 0);
				}
				return stringValue;
			}
        }
        public IFieldControl<int> IntValue
        {
			get
			{
				if (intValue == null)
				{
					intValue = new FieldControl<int>();
					intValue.LinkToParent("IntValue", this, get_IntValue_value, set_IntValue_value, 0);
				}
				return intValue;
			}
		}
        public IFieldControl<decimal> DecimalValue
        {
			get
			{
				if (decimalValue == null)
				{
					decimalValue = new FieldControl<decimal>();
					decimalValue.LinkToParent("DecimalValue", this, get_DecimalValue_value, set_DecimalValue_value, 0);
				}
				return decimalValue;
			}
		}
        #endregion

        #region getters and setters
		private string get_StringValue_value(int index) { return Value.StringValue; }
		private void set_StringValue_value(string value, int index) { Value.StringValue = value; }
		private int get_IntValue_value(int index) { return Value.IntValue; }
		private void set_IntValue_value(int value, int index) { Value.IntValue = value; }
		private decimal get_DecimalValue_value(int index) { return Value.DecimalValue; }
		private void set_DecimalValue_value(decimal value, int index) { Value.DecimalValue = value; }
        #endregion
    }
}
